$.setBaseFontSize(16);
$.useConfig({
	alias: {
		router: "router.0.0.1.js",
		index: "main_index.0.0.1.js",
		api: "api.0.0.1.js",
		components: "components.0.0.1.js",
		common: "common.0.0.1.js",
		addDom: "adddom.0.0.1.js"
	},
	base: "//192.168.10.47/other/dist/test/js/0.0.1/"
});
import "noptempalte_tag";

var css = (<style>
	.addmain{background-color:#efefef;}
	.addmain h1{font-size:14px}
	div > p {
		padding:20px;
		background-color:#999;
	}
</style>);
$.query("head")[0]._append(css);

var lessCss = @lessParse(<style>
		@base:23.44/1rem;
		body{
			padding:10/@base;
		}
	</style>),
	lessCssA = @lessParse(<style>
		@base:23.44/1rem;
		body{
			padding:15/@base;
			&.on{
				padding:20/@base 0;
				border-radius:10@base;
			}
		}
	</style>);
$.query("head")[0]._append(lessCss)._append(lessCssA);

var metas = (<meta name="apple-mobile-web-app-capable" content="yes" />
<meta name="apple-mobile-web-app-status-bar-style" content="blank" />
<meta name="format-detection" content="telephone=no" />);
$.query("head")[0]._append(metas._children());

$.Mobile("ios_weixin_iframe_title", {title: "ios_weixin_iframe_title test"});

define((require, exports, module) => {
	$.use("common router api", () => {
		var common = require('common').done();
		var type = common.getURLKeyValue(location.href, "t");
		var newFullPage;
		var app = $.Status("#app", {
			store: {
				state: {
					api: require("api").done(true),
					history: $.html5api().history().on((e) => {
						console.log(e)
						if (e.state && e.state.type === "share"){
							app && app.render(e.state.type)
						}else{
							app && app.render(type || 'main')
						}
					})
				},
				props: {}
			},
			router: require('router').done(() => {
				return app;	
			}),
			renderDom(data) {
				$.use("index", () => {
					require("mymain").done(data, app);
				});
			}
		}).set({
			main: {
				props: {
					nextStatusName: "share",
					status: 1,
					tabsLen: 3,
					tabsItem_left: "left",
					tabsItem_center: "center",
					tabsItem_right: "right"
				},
				handle: {
					componentWillMount: (next) => {
						console.log("componentWillMount1");
						next();
					},
					componentDidMount: (next) => {
						console.log("componentDidMount1");
						next();
					}
				},
				created: (elem) => {
					var a = $.query("#a")[0] && $.query("#a")[0]._serialize();
					console.log(a);
					console.log("created1", elem);
					$.render("noptempalte_tagpjs", {}, $.query("#noptempalte"));
					$.use("http://i0.hexun.com/2016/modules/fullpage.min.js".split(' '), () => {
						if (newFullPage) {
							newFullPage.destroy();
						}
						newFullPage = new fullpage('#myContainer', {
							scrollHorizontally: true,
							noFullScreen: true,
							sectionsColor: ['#f2f2f2', '#4BBFC3', '#7BAABE', 'whitesmoke']
						});
					})
				}
			},
			share: {
				props: {
					nextStatusName: "main",
					status: 2,
					tabsLen: 2,
					tabsItem_left: "left",
					tabsItem_right: "right"
				},
				handle: {
					componentWillMount: (next) => {
						console.log("componentWillMount2");
						next();
					},
					componentDidMount: (next) => {
						console.log("componentDidMount2");
						next();
					}
				}
			}
		});
		app.render(type || "main");
	});
});